/*
 * DissimilarityMatrix.h
 *
 *  Created on: Aug 25, 2012
 *      Author: alberto
 *
 * Implementa a matriz de dissimilaridades e os métodos para seu cálculo
 */

#ifndef DISSIMILARITYMATRIX_H_
#define DISSIMILARITYMATRIX_H_

#include "ImageContainer.h"
#include "Utilities.h"

#include <opencv2/core/core.hpp>
#include <opencv2/nonfree/nonfree.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/video/video.hpp>
#include <opencv2/calib3d/calib3d.hpp>

#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <jpeglib.h>
#include <time.h>

using namespace std;
using namespace cv;

class DissimilarityMatrix {
public:
	DissimilarityMatrix(const ImageContainer& group);
	virtual ~DissimilarityMatrix();
	void computeImageGroupKeypoints();
	void buildDissimilarity();
	ImageContainer getImageGroup() const;
	Mat getDissimilarity();


private:
	Mat Dissimilarity;
	vector<vector<KeyPoint> > imageGroupKeypoints;
	vector<Mat> imageGroupDescriptors;
	vector<vector<DMatch> > imageGroupMatches;
	ImageContainer imageGroup;

	void estimateAffineWarp(const Mat& imageA, const Mat& imageB, Mat& transformedA);
	void histogramEspecification(Mat& imageA, Mat& imageB);
	void estimateCompression(const Mat& imageA, const Mat& imageB, string nameB, Mat& recompressedA);
	double ComputeImageCorrelation(const Mat& imageA, const Mat& imageB, string nameA, string nameB);

};

#endif /* DISSIMILARITYMATRIX_H_ */
